//
//  MCSettingTableViewCell.m
//  TLYL
//
//  Created by MC on 2017/6/12.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCSettingTableViewCell.h"
@interface MCSettingTableViewCell ()
@property (nonatomic,strong)UILabel *titleLab;
@property (nonatomic,strong)UIView  *lineView;
@property (nonatomic,strong)UILabel *tipLab;
/*
 * 箭头
 */
@property (nonatomic,strong)UIImageView * arrowImgV;
@end

@implementation MCSettingTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        [self initView];
    }
    return self;
}

- (void)initView{
    
    self.backgroundColor=[UIColor whiteColor];
    
    _titleLab =[[UILabel alloc]init];
    _titleLab.textColor=[UIColor grayColor];
    _titleLab.font=[UIFont systemFontOfSize:15];
    _titleLab.text =@"加载中";
    _titleLab.textAlignment=NSTextAlignmentLeft;
    [self  addSubview:_titleLab];
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(0);
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.mas_left).offset(20);
    }];

    _lineView=[[UIView alloc]init];
    [self addSubview:_lineView];
    _lineView.backgroundColor=RGB(200, 200, 200);
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(self.mas_left).offset(10);
        make.right.equalTo(self.mas_right).offset(-10);
        make.height.mas_equalTo(1);
    }];
    
    /*
     * 箭头
     */
    _arrowImgV=[[UIImageView alloc]init];
    [self addSubview:_arrowImgV];
    _arrowImgV.image=[UIImage imageNamed:@"矩形-11-拷贝-3"];
    /*
     * 箭头
     */
    [_arrowImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-10);
        make.height.mas_equalTo(21*0.5);
        make.width.mas_equalTo(12*0.5);
    }];
    
    _tipLab=[[UILabel alloc]init];
    [self addSubview:_tipLab];
    _tipLab.textColor=[UIColor grayColor];
    _tipLab.font=[UIFont systemFontOfSize:15];
    _tipLab.text =@"";
    _tipLab.textAlignment=NSTextAlignmentLeft;
    [_tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(0);
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(_arrowImgV.mas_left).offset(0);
    }];

    
}
- (void)awakeFromNib {
    [super awakeFromNib];
}
-(void)setDataSource:(id)dataSource{
    _dataSource=dataSource;
    _titleLab.text=dataSource;
    if ([dataSource isEqualToString:@"版本升级"]) {
        _tipLab.text=@"v0.12 ";
        _tipLab.hidden=NO;
    }else{
        _tipLab.hidden=YES;
    }
        
}
+(CGFloat)computeHeight:(id)info{
    return 50;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
